<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<link rel="stylesheet" href="../static/zyc/css/emp_Authority.css?<%=Math.random()%>">
	<script type="text/javascript">
		$(document).ready(function(){
			$(".aut_ta_3").click(function () {
				if($(this).attr("class")=="aut_ta_3 aut_bg_t"){
					$(this).removeClass("aut_bg_t");
					$(this).addClass("aut_bg_f");
				}else if($(this).attr("class")=="aut_ta_3 aut_bg_f"){
					$(this).removeClass("aut_bg_f");
					$(this).addClass("aut_bg_t");
				}else if($(this).attr("class")=="aut_ta_3 aut_bg_"){
					$(this).removeClass("aut_bg_");
					$(this).addClass("aut_bg_t");
				}
			});
			$(".aut_ta_1").click(function () {
				var aut = $(this).parent()
				//alert(aut.attr("class"));
				if(aut.attr("class")=="aut_ta aut_ta_t"){
					aut.removeClass("aut_ta_t");
					aut.addClass("aut_ta_f");
				}else if(aut.attr("class")=="aut_ta aut_ta_f"){
					aut.removeClass("aut_ta_f");
					aut.addClass("aut_ta_t");
				}else if(aut.attr("class")=="aut_ta aut_ta_"){
					aut.find(".aut_ta_3").removeClass("aut_bg_");
					aut.find(".aut_ta_3").addClass("aut_bg_t");
					aut.removeClass("aut_ta_");
					aut.addClass("aut_ta_t");
				}
			});
			$('#tt-pot').tree({
			    url: "authority_pot",
			    loadFilter: function(data){
			    	//alert(data[0]['zji']);
					if (data.d){
						return data.d;
					} else {
						return data;
					}
			    },
				onClick: function(node){
					alert(node.id);
					$.ajax({
						url: "aut_pot",
						data:{
							potid:node.id
						},
						success: function(data){
							
						}
					});
				}
			});
			$('#p-pot').panel({
			    width:300,
			    height:420,
			    title:'职位权限',
			    tools:[{
			    }]
			}); 
		});
		function preser(){
			var i=$(".aut_ta_3").length;
			for(var j=0;j<i;j++){
				var st;
				if($(".aut_ta_3:eq("+j+")").attr("class")=="aut_ta_3 aut_bg_t"){st="true";}else{st="false";}
				alert("id="+$(".aut_ta_3:eq("+j+")").attr("id")+",sf="+st);
			}
		}
	</script>
	<div class="full_scr">
		<div class="aut aut_t">
			<span class="text_style_title">员工权限设置</span>
			<button onclick="preser()">保存</button>
			<button onclick="">重置</button>
		</div>
		<div class="aut aut_l len">
			<c:forEach items="${Authority}" var="a">
				<div class="aut_ta aut_ta_${a.sf}">
					<div class="len aut_ta_1" id="${a.yid}">${a.name}</div>
					<div class="rin aut_ta_2">
						<c:forEach items="${a.aut}" var="s">
							<div class="aut_ta_3 aut_bg_${s.sf}" id="${s.yid}">${s.name}</div>
						</c:forEach>
					</div>
				</div>
			</c:forEach>
		</div>
		<div id="p-pot" class="aut aut_r rin">
			<ul id="tt-pot"></ul>
		</div>
	</div>
</body>
</html>